package com.jay.lang.reflect.clazz;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import com.jay.lang.annotation.intf.MyAnnotation1;

public class MethodCls {
	public static void main(String[] args) throws InstantiationException,
			IllegalAccessException, IllegalArgumentException,
			InvocationTargetException {
		Method[] ms = C.class.getDeclaredMethods();
		for (Method m : ms) {
			System.out.println("---------------------");
			System.out.println(m.getName());
			System.out.println(m.getModifiers());
			System.out.println(m.isAccessible());
			System.out.println(m.isAnnotationPresent(MyAnnotation1.class));
			System.out.println(m.isSynthetic());
			System.out.println(m.isBridge());
			System.out.println(m.getDefaultValue());
			System.out.println(m.isVarArgs());
			System.out.println(m.getReturnType());
		}
		Method m = ms[1];
		m.setAccessible(true);
		int i = (int) m.invoke(new C(), 12);
		System.out.println("return " + i);
	}
}

class C {
	public void AAA1() {
	}

	private int AAA2(int i) {
		return 108;
	}

	protected String A(int i, String s) {
		return s;
	}
}